//引入axios请求
import request from "@/utils/request";

//1.登录接口请求
//参数类型接口
export interface reqLoginParamType {
  username: string;
  password: string;
}
//返回值类型
export interface reqLoginReturnType {
  token: string;
}
//请求函数
export const requestLogin = (loginParam: reqLoginParamType) => {
  return request.post<any, reqLoginReturnType>(
    `/admin/acl/index/login`,
    loginParam
  );
};

//2.用户信息请求接口
//返回值参数类型接口
export interface reqUserInfoReturnType {
  routes: string[];
  buttons: string[];
  roles: string[];
  name: string;
  avatar: string;
}
//请求函数
export const requestUserInfo = () => {
  return request.get<any, reqUserInfoReturnType>(`/admin/acl/index/info`);
};

//3.退出登陆请求
//请求函数
export const requestLogout = () => {
  return request.post(`/admin/acl/index/logout`);
};
